
import variables from '@/styles/element-variables.scss'
import defaultSettings from '@/settings'

const { showSettings, tagsView, fixedHeader, sidebarLogo } = defaultSettings

const state = {
  theme: variables.theme,
  showSettings: showSettings,
  tagsView: tagsView,
  fixedHeader: fixedHeader,
  sidebarLogo: sidebarLogo,
  storeDiy: 1,
  isEdit: false,
  routeDays: [],
}

const mutations = {
  CHANGE_SETTING: (state, { key, value }) => {
    if (state.hasOwnProperty(key)) {
      state[key] = value
    }
  },
  STOREDIY: (state, value) => {
    state.storeDiy = value
  },
   SET_ISEDIT: (state, isEdit) => {
    state.isEdit = isEdit
  },
  SET_ROUTE_DAYS: (state, routeDays) => {
    console.log(1111,routeDays)
    state.routeDays = routeDays
  },
}

const actions = {
  changeSetting({ commit }, data) {
    commit('CHANGE_SETTING', data)
  },
   setEdit({ commit }, isEdit) {
    commit('SET_ISEDIT', isEdit)
  },
  setRouteDays({ commit }, routeDays) {
    commit('SET_ROUTE_DAYS', routeDays)
  }
}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}

